fix(server): fail V2 turns when the OpenCode event stream ends - #9905
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a small, self-contained OpenCode EOF bug fix that terminates active turns consistently, blocks invalid follow-up work, and adds targeted race-condition coverage. It does not alter healthy-path behavior, schemas, product defaults, or static-analysis configuration. You can add or adjust custom eligibility rules. Learn more. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ed8886de32e7b7877eed2b52eb80daddf5e46484. Configure here.
b82facd to
2ac9bfe
Compare
9f4f5e0 to
8d4d71b
Compare
There was a problem hiding this comment.
All clear
Posted via Macroscope — Effect Service Conventions
efd9994 to
6102d00
Compare
f134f08 to
02f7c19
Compare
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
Dismissing prior approval to re-evaluate 02f7c19
There was a problem hiding this comment.
All clear
Posted via Macroscope — Effect Service Conventions
|
All clear Posted via Macroscope — Effect Service Conventions |
ed5dc41 to
2b1139a
Compare
1b78928 to
49d5625
Compare
Dismissing prior approval to re-evaluate 49d5625
209fe68
into
pingdotgg:t3code/codex-turn-mapping
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

After OpenCode's event stream ends, reject new turns and prevent a racing compaction response from reporting success. End the adapter event queue after delivering the transport failure so consumers can reconnect.
Rebased the remaining changes onto v2, which already fails active turns on EOF. Preserved current descendant cleanup and normal shutdown handling.
Validation: all three added EOF/race tests hang on the base (bounded to 2 seconds for the negative run); all 40 OpenCode adapter tests pass with the fix. Scoped formatting/lint and server typechecking pass. CI and Claude Fable 5.1 review are checked before merge.
Prepared with Codex/T3 from the original contribution; independent review requested from Claude Fable 5.1.